package com.handl.springcloud.servie;

import com.handl.springcloud.dto.User;
import com.handl.springcloud.service.UserService;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Created by handl on 2017/11/6.
 *
 * 1.feign中service的定义已经在抽象抽离服务中定义完成，这里只需要继承即可
 * 2.这里要做的就是添加指定服务，通过@FeignClient注解
 *
 */
@FeignClient("eurekaclientfeign")
public interface UserServiceFeign extends UserService {

    //3.不通过抽象抽离服务，自己定义调用接口直接调用服务提供者
    @RequestMapping("self1")
    String self1(@RequestParam("name") String name);
    @RequestMapping("self2")
    String self2(@RequestHeader("des") String des);
    @RequestMapping("self3")
    User self3(@RequestBody User user);
}
